﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Template/Site_Main.Master" AutoEventWireup="true" CodeBehind="IsMaturedList.aspx.cs" Inherits="RegisterationSystem.Space_Education.IsMaturedList" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<script type="text/javascript">
      <!--
        $(function () {
            //设置导航位置
            setLocalToParent();
            //初始化隐藏层
            $('#plastudentinfo').dialog({   
                closed: true
            });
            var products = <%=ShcJson %>;
             //初始化社区下拉菜单
            $("#pcommunity").combobox({
                url: "../SyncService/GetDataList.ashx?action=GetCommListAddAll&parentID=0",
                valueField: 'id',
                textField: 'name',
                //加载后触发
                onLoadSuccess: function () {
                    var sdata = $('#pcommunity').combobox('getData');
                    if (sdata.length > 0) {
                        $("#pcommunity").combobox('select', sdata[0].id);
                    }
                },
                //选择触发
                onSelect: function (sdata) {
                    //加载小区
                    $("#scommunity").combobox({
                        url: "../SyncService/GetDataList.ashx?action=GetCommListAddAll&parentID=" + sdata.id,
                        valueField: 'id',
                        textField: 'name',
                        //加载后触发
                        onLoadSuccess: function (xpd) {
                        var sdata = $('#scommunity').combobox('getData');
                            $('#scommunity').combobox("select", xpd[0].id);
                        },
                        //选择触发
                                               onSelect: function (sdata) {
                                                   $("#xcommunity").combobox({
                        url: "../SyncService/GetDataList.ashx?action=GetCommListAddAll&parentID=" + sdata.id,
                        valueField: 'id',
                        textField: 'name',
                        //加载后触发
                        onLoadSuccess: function (xpd1) {
                       
                            $('#xcommunity').combobox("select", xpd1[0].id);
                        }
                                                   
                                                   })
                                               }
                    })
                }
            });
            //初始化企业用户数据列表控件
            $("#dg").datagrid({
                idField: "id",      //标识字段,主键
                url: "../SyncService/GetDataList.ashx?action=getundistributedstulist",
                queryParams: { "where": "1=1" ,"typeid":"5"},
                pagination: true,   //是否开启分页
                rownumbers: true,   //行号
                pageSize: 10,
                pageNumber: 1,
                columns: [[
                            { field: 'ck', checkbox: true },
                            { field: 'schid', title: '所属学校 ', width: 125, align: 'center',
                                formatter: function (value) {
                                    for (var i = 0; i < products.length; i++) {
                                        if (products[i].id == value) return products[i].name;
                                    }
                                    return "暂无学校";
                                }
                            },
                            { field: 'truename', title: '学生姓名', width: 90, align: 'center' },
                            { field: 'sex', title: '性别', width: 60, align: 'center', formatter: function (value, row) {
                                if (value) {
                                    return "女";
                                } else {
                                    return "男";
                                }
                            }
                            },
                            { field: 'idcardnumber', title: '证件号(身份证/护照)', width: 135, align: 'center' },
                            { field: 'houseareaid', title: '户口所在地', width: 163, align: 'center', formatter: function (value, row) {
                                switch (value) {
                                case "0" :
                                    return "武汉经济技术开发区（汉南区）";
                                break;
                                case "1" :
                                    return "市内其它区";
                                break;
                                case "2" :
                                    return "省内市外、外省外市";
                                break;
                                case "3":
                                    return "外籍(含港澳台)";
                                break;
                                }
                            }
                            },
                            { field: 'pianname', title: '住房片区', width: 125, align: 'center' },
                            { field: 'scommname', title: '住房社区', width: 120, align: 'center'},
                            { field: 'xcommname', title: '住房小区', width: 120, align: 'center'},
                            { field: 'level', title: '生源类型', width: 60, align: 'center', formatter: function (value, row) {
                                switch (value) {
                                case "0" :
                                    return "A";
                                break;
                                case "1" :
                                    return "B";
                                break;
                                case "2" :
                                    return "C";
                                break;
                                case "3":
                                    return "D";
                                break;
                                }
                            }
                            },
                            { field: 'id', title: '查看详细信息', width: 105,align: 'center', formatter: function (value, row) {
                                return "<a href='javascript:void(0)'  onclick='GetByStudentInfo("+value+");'>查看详细信息</a>";
                            }
                            }
                         ]]
            })
        });
        //-->
        //查询
        function SelDistributedStuList()
        {
            var where ="";
            where +=$("#txtname").val()+",";//学生姓名
            where+=$("#txtIDCardNumber").val()+",";//学生身份证
            where+=$("#ddlsex").combobox('getValue')+","; //性别
            where+=$("#<%= ddlSchoolInfo.ClientID %>").combobox("getValue")+",";//所属学校 
            where+=$("#ddlHouse").combobox("getValue")+",";//户口所在地
            where+=$("#scommunity").combobox("getValue")+",";//住房社区
            where+=$("#xcommunity").combobox("getValue")+",";//住房小区
            where+=$("#SelLevel").combobox("getValue")+",";//学生等级
            where+=$("#Birthday").datebox('getValue')+",";//出生日月
            where+=$("#Birthday1").datebox('getValue')+",";//出生日月
            where += $("#pcommunity").datebox('getValue') + "";
            $('#dg').datagrid({ url: "../SyncService/GetDataList.ashx?action=getundistributedstulist", queryParams: { "where": where,"typeid":"5"} });
            $('#dg').datagrid('reload');
        }

        //弹出学生详细信息
        function GetByStudentInfo(stdID) {
            $.post("../SyncService/GetDataList.ashx", 
                { "action": "GetStudentByID", "id": stdID }, 
                function (cStr) {
                    var stdInfo= eval('(' + cStr + ')');
                    $("#<%= hidstuID.ClientID %>").val(stdID);
                    $("#spanname").text(stdInfo.name);//姓名
                    $("#spansex").text(stdInfo.sex);//性别
                    $("#spanbirthday").text(stdInfo.birthday);//出生年月
                    $("#spanidcardnumber").text(stdInfo.idcardnumber);//学生身份证
                    $("#HouseIngoingTime").text(stdInfo.HouseIngoingTime);//户口迁入时间
                    $("#HousingOccupancyTime").text(stdInfo.HousingOccupancyTime);//住房入住时间
                    $("#PermanentAddress").text(stdInfo.PermanentAddress);//户籍地址
                   // $("#spanhobby").text(stdInfo.hobby);//兴趣爱好
                    $("#spanfirstguardianname").text(stdInfo.firstguardianname);//第一监护人
                    $("#spanfirstguardianunit").text(stdInfo.firstguardianunit);//工作单位
                    $("#spanfirstguardianphone").text(stdInfo.firstguardianphone);//联系电话
                    $("#spansecguardianname").text(stdInfo.secguardianname);//第二监护人
                    $("#spansecguardianunit").text(stdInfo.secguardianunit);//工作单位
                    $("#spansecguardianphone").text(stdInfo.secguardianphone);//联系电话
                    switch (stdInfo.houseareaid) {
                        case "0":
                        $("#spanhouseareaid").text("武汉经济技术开发区（汉南区）");//户口所在地
                        break;
                        case "1":
                        $("#spanhouseareaid").text("市内其它区");//户口所在地
                        break;
                        case "2":
                        $("#spanhouseareaid").text("省内市外、外省外市");//户口所在地
                        break;
                          case "3":
                        $("#spanhouseareaid").text("外籍(含港澳台)"); //户口所在地
                        break;
                    }
                    $("#spanpcommname").text(stdInfo.pcommname);
                    $("#spanscommname").text(stdInfo.scommname);//住房社区
                    $("#spanxcommname").text(stdInfo.xcommname);//住房小区
                    $("#spanhousenumber").text(stdInfo.housenumber);//门牌号
                    $("#spanhousecard").text(stdInfo.housecard);//房产号
                    $("#spanfirstrelationship").text(stdInfo.firstrelationship);//与学生关系
                    $("#spansecrelationship").text(stdInfo.secrelationship);//与学生关系
                },
                "text");
            //弹层
            $('#plastudentinfo').dialog({
                title: '学生信息',
                width: 600,
                height: 425,
                closed: false,
                cache: false,
                modal: true,
                collapsible: true,
                maximizable: false
            });
        }
         //重置学生用户密码
        function UpdStudentPswdReset(StudentPswd) {
            $.messager.confirm('提示', '确认重置密码？', function (r) {
                if (r) {
                    $.post(location.href, { "action": "pswdreset", "id": $("#<%= hidstuID.ClientID %>").val(), "StudentPswd": StudentPswd }, function (data) {
                        $.messager.alert("消息提示", "重置成功！");
                         $('#plastudentinfo').dialog("close");
                        $('#dg').datagrid('reload');
                    });
                }
            });
        }


                //把符合条件选定的数据导出excel
        function derive_excel() {
            var mess = "";
            var altmess = "";
                mess = "确认导出excel？";
                altmess = "导出excel成功!"
            //id集合
            var ids = "";
            //获取选择集合
            var rows = $('#dg').datagrid('getSelections');
            if (rows.length == 0) {
                alert("请选择行");
                return false;
            }
            //遍历选择行
            for (var i = 0; i < rows.length; i++) {
                ids += rows[i].id + ",";
            }

             $.messager.confirm('提示', mess, function (r) {
                if (r) {
                    $.ajax({
                        type: "POST",
                        url: "../SyncService/EduExcelHelper.ashx?type=derive_excelList&id=" + ids,
                        //                data: { "type": "loadReport", "typeid": "0", "where": "" + where + "" },
                        datatype: "text",
                        cache: false,
                        success: function (data) {
                            if (data == "0") {
                                alert("导出excel失败");
                            }
                            else {
                                try {
                                    window.location = data;
                                } catch (e) {

                                }
                            }
                        }
                    });
                }
            });
//            $.messager.confirm('提示', mess, function (r) {
//                if (r) {
//                    $.post(location.href, { "action": "derive_excelList", "id": ids }, function (data) {
//                        window.location = data;
//                    });

//                }
//            });
}

//把符合条件的所以数据导出excel
function derive_excelAll() {
   var mess = "";
   mess = "确认导出excel？";
  var where ="";
            where +=$("#txtname").val()+",";//学生姓名
            where+=$("#txtIDCardNumber").val()+",";//学生身份证
            where+=$("#ddlsex").combobox('getValue')+","; //性别
            where+=$("#<%= ddlSchoolInfo.ClientID %>").combobox("getValue")+",";//所属学校 
            where+=$("#ddlHouse").combobox("getValue")+",";//户口所在地
            where+=$("#scommunity").combobox("getValue")+",";//住房社区
            where+=$("#xcommunity").combobox("getValue")+",";//住房小区
            where+=$("#SelLevel").combobox("getValue")+",";//学生等级
            where+=$("#Birthday").datebox('getValue')+",";//出生日月
            where+=$("#Birthday1").datebox('getValue')+"";//出生日月

             $.messager.confirm('提示', mess, function (r) {
                if (r) {
                    $.ajax({
                        type: "POST",
                        url: "../SyncService/EduExcelHelper.ashx?type=derive_excelListAll&typeid=5&where=" + where,
                        //                data: { "type": "loadReport", "typeid": "0", "where": "" + where + "" },
                        datatype: "text",
                        cache: false,
                        success: function (data) {
                            if (data == "0") {
                                alert("导出excel失败");
                            }
                            else {
                                try {
                                    window.location = data;
                                } catch (e) {

                                }
                            }
                        }
                    });
                }
            });
//            $.messager.confirm('提示', mess, function (r) {
//        if (r) {
//            $.post(location.href, { "action": "derive_excelListAll", "where": where,"typeid":"5" }, function (data) {
//                window.location = data;
//            });

//        }
//    });
}
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Place_Local" runat="server">
 <div class="localTitle">
        <a>不足龄学生信息</a>
    </div>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
  <!--选择的学生信息编号-->
    <asp:HiddenField ID="hidstuID" runat="server" />
<div class="loadheight">
        <table width="100%%" border="0" cellspacing="0" cellpadding="0">
            <tr>
                <td bgcolor="#FFFFFF">
                    <table width="100%%" border="0" cellspacing="0" cellpadding="0">
                        <tr>
                            <td>
                                <table width="100%" border="0" cellpadding="0" cellspacing="0">
                                </table>
                            </td>
                        </tr>
                    </table>
                    <table width="100%%" border="0" cellspacing="0" cellpadding="0">
                        <tr>
                            <td class="cen_R_dh">
                                <strong>不足龄学生查询</strong>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <table width="100%" border="0" cellpadding="0" cellspacing="1">
                                    <tr>
                                        <td height="20">
                                            <table width="100%%" border="0" cellspacing="0" cellpadding="3">
                                            </table>
                                            <div style="margin-top: 5px">
                                            </div>
                                            <table width="688" border="0" cellpadding="3" cellspacing="1" bgcolor="#CCCCCC">
                                                <tr>
                                                    <td width="100" height="20" align="center" bgcolor="#FFFFFF">
                                                        学生姓名
                                                    </td>
                                                    <td width="200" bgcolor="#FFFFFF">
                                                        <input type="text" id="txtname" style="width: 130px;" class="easyui-validatebox"
                                                            maxlength="10" />
                                                    </td>
                                                    <td width="100" align="center" bgcolor="#FFFFFF">
                                                        <span>性别</span>
                                                    </td>
                                                    <td align="left" bgcolor="#FFFFFF" colspan="3">
                                                        <select id="ddlsex" class="easyui-combobox" data-options="required:true,editable:false">
                                                            <option value="99">全部</option>
                                                            <option value="0">男</option>
                                                            <option value="1">女</option>
                                                        </select>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td width="100" height="20" align="center" bgcolor="#FFFFFF">
                                                        学生身份证号
                                                    </td>
                                                    <td width="200" bgcolor="#FFFFFF">
                                                        <input type="text" id="txtIDCardNumber" style="width: 200px;" maxlength="18" class="easyui-validatebox" />
                                                    </td>
                                                    <td width="100" align="center" bgcolor="#FFFFFF">
                                                        所属学校
                                                    </td>
                                                    <td align="left" bgcolor="#FFFFFF" colspan="3">
                                                        <asp:DropDownList ID="ddlSchoolInfo" runat="server" class="easyui-combobox" data-options="required:true,editable:false">
                                                        </asp:DropDownList>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td width="100" height="20" align="center" bgcolor="#FFFFFF">
                                                        户口所在地
                                                    </td>
                                                    <td width="200" bgcolor="#FFFFFF" >
                                                        <select id="ddlHouse" class="easyui-combobox" data-options="required:true,editable:false">
                                                            <option value="99">全部</option>
                                                            <option value="0">武汉经济技术开发区（汉南区）</option>
                                                            <option value="1">市内其它区</option>
                                                            <option value="2">省内市外、外省外市</option>
                                                             <option value="3">外籍(含港澳台)</option>
                                                        </select>
                                                    </td>
                                                    <td width="100" align="center" bgcolor="#FFFFFF">
                                                        出生日月
                                                    </td>
                                                    <td align="left" bgcolor="#FFFFFF" colspan="3">
                                                        <input type="text" id="Birthday" style="width: 120px; height: 20px;" class="easyui-datebox"
                                                            data-options="editable:false" />-<input type="text" id="Birthday1" style="width: 120px;
                                                                height: 20px;" class="easyui-datebox" data-options="editable:false" />
                                                    </td>
                                                </tr>
                                                <tr>
                                                 <td width="100" height="20" align="center" bgcolor="#FFFFFF">
                                                        住房片区
                                                    </td>
                                                    <td width="200" bgcolor="#FFFFFF">
                                                        <select id="pcommunity" class="easyui-combobox" data-options="editable:false" style="width: 120px;">
                                                        </select>
                                                    </td>
                                                    <td width="100" height="20" align="center" bgcolor="#FFFFFF">
                                                        住房社区
                                                    </td>
                                                    <td width="200" bgcolor="#FFFFFF">
                                                        <select id="scommunity" class="easyui-combobox" data-options="editable:false" style="width: 120px;">
                                                        </select>
                                                    </td>
                                                    <td width="100" align="center" bgcolor="#FFFFFF">
                                                        住房小区
                                                    </td>
                                                    <td align="left" bgcolor="#FFFFFF">
                                                        <select id="xcommunity" class="easyui-combobox" data-options="editable:false" style="width: 120px;">
                                                        </select>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td width="100" height="20" align="center" bgcolor="#FFFFFF">
                                                        生源类型
                                                    </td>
                                                    <td width="200" bgcolor="#FFFFFF">
                                                        <select id="SelLevel" class="easyui-combobox" data-options="required:true,editable:false">
                                                            <option value="99">全部</option>
                                                            <option value="0">A</option>
                                                            <option value="1">B</option>
                                                            <option value="2">C</option>
                                                        </select>
                                                    </td>
                                                    <td width="100" align="center" bgcolor="#FFFFFF">
                                                    </td>
                                                    <td align="left" bgcolor="#FFFFFF" colspan="3">
                                                    </td>
                                                </tr>
                                            </table>
                                        </td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                    </table>
                    <div style="margin-top: 5px">
                    </div>
                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                        <tr>
                            <td width="200">
                                &nbsp;
                            </td>
                            <td>
                                <input type="button" name="button" id="button" value="查询" class="anniu" width="73"
                                    height="27" onclick="SelDistributedStuList();" />
                            </td>
                        </tr>
                    </table>
                    <div style="height: 5px;">
                    </div>
                    <table width="100%%" border="0" cellspacing="0" cellpadding="1">
                        <tr>
                            <td class="cen_R_dh">
                                <strong>不足龄学生列表</strong>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <!-- 创建数据列表控件 -->
                                <table id="dg">
                                </table>
                                 <div style="height: 10px;">
                                </div>
                                <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                    <tr>
                                        <td align="left">
                                                 <input type="button" name="button1" id="button3" value="选定导出Excel" class="anniu_big" width="73px"
                                                height="23px" onclick="derive_excel();" />
                                                <input type="button" name="button1" id="button4" value="全部导出Excel" class="anniu_big"
                                                height="23px" onclick="derive_excelAll();" />
                                        </td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                    </table>
                    <!--弹出学生详细信息-->
                    <div id="plastudentinfo" class="easyui-dialog tcc_M">
                        <div class="tcc_div" style="margin-left: 20px;">
                            <ul>
                                <li class="tcc_BT">学生详细信息</li>
                                <li>姓名：<span id="spanname"></span></li>
                                <li>性别：<span id="spansex"></span></li>
                                <li>证件号(身份证/护照)：<span id="spanidcardnumber"></span>&nbsp;<a href='javascript:void(0)' onclick='UpdStudentPswdReset(123456);' style="color:#990000">密码重置</a></li>
                                <li>出生年月：<span id="spanbirthday"></span></li>
                                <li>户口所在地：<span id="spanhouseareaid"></span></li>
                                <li>住房片区：<span id="spanpcommname"></span></li>
                                <li>住房社区：<span id="spanscommname"></span></li>
                                <li>住房小区：<span id="spanxcommname"></span></li>
                                <li>门牌号：<span id="spanhousenumber"></span></li>
                                <li>房产证号：<span id="spanhousecard"></span></li>
                                <li>户口迁入时间：<span id="HouseIngoingTime"></span></li>
                                <li>住房入住时间：<span id="HousingOccupancyTime"></span></li>
                                <li>户籍地址：<span id="PermanentAddress"></span></li>
                               <%-- <li>兴趣爱好：<span id="spanhobby"></span></li>--%>
                            </ul>
                        </div>
                        <div class="tcc_div" style="float: right">
                            <ul>
                                <li class="tcc_BT">监护人信息</li>
                                <li>第一监护人：<span id="spanfirstguardianname"></span></li>
                                <li>与学生关系：<span id="spanfirstrelationship"></span></li>
                                <li>工作单位：<span id="spanfirstguardianunit"></span></li>
                                <li>联系电话：<span id="spanfirstguardianphone"></span></li>
                                <li>&nbsp;</li>
                                <li>第二监护人：<span id="spansecguardianname"></span></li>
                                <li>与学生关系：<span id="spansecrelationship"></span></li>
                                <li>工作单位：<span id="spansecguardianunit"></span></li>
                                <li>联系电话：<span id="spansecguardianphone"></span></li>
                            </ul>
                        </div>
                    </div>
                </td>
            </tr>
        </table>
    </div>
</asp:Content>
